import { StringUtils } from './StringUtils';
import { AssetStore } from './AssetStore';
import util from "@ohos.util";
export class DeviceUtils {
    static async getDeviceId() {
        let deviceId = DeviceUtils.deviceId;
        if (StringUtils.isEmpty(deviceId)) {
            deviceId = StringUtils.toString((await AssetStore.get(DeviceUtils.deviceIdCacheKey)).data);
        }
        if (StringUtils.isEmpty(deviceId)) {
            deviceId = util.generateRandomUUID(true).replace('-', '');
            AssetStore.set(DeviceUtils.deviceIdCacheKey, deviceId);
        }
        DeviceUtils.deviceId = deviceId;
        return deviceId;
    }
}
DeviceUtils.deviceIdCacheKey = "device_id_cache_key";
DeviceUtils.deviceId = "";
